package parder

import (
	"parser/engine"
	"regexp"
)

const cityListRe = `<a href="(http://www.zhenai.com/zhenghun/[0-9a-z]+)"[^>]*>([^<]*)</a>`
func ParserCityList(content []byte) engine.ParserResult {
	re:=regexp.MustCompile(cityListRe)
	matches := re.FindAllSubmatch(content,-1)
	result :=engine.ParserResult{}
	i := 0
	for _, value := range matches {
		result.Items  = append(result.Items,string(value[2]))
		result.Requests  = append(result.Requests,engine.Request{Url: string(value[1]),ParserFunc:ParseCity } )
		i++
		if i >= 2 {
			break
		}
	}
	return result
}